

import os

from cfcall import cfgseg
from cfcall.utils import importutils


def load_allcfg_obj():

    objs = []
    for f in os.listdir(cfgseg.__path__[0]):
        ext = f.split(".")[1]
        if f not in ["__init__.py", "cfgsegbase.py"]\
            and ext in ["py"]:
            
            modstr = f.split(".")[0]
            classstr = modstr.split("_")
            
            mod = "cfcall.cfgseg." +  modstr + "." + classstr[0]
            for clsseg in classstr[1:-1]:
                mod += clsseg.capitalize() \
                  
            mod+=classstr[-1].upper()

            
            print f, mod

            objs.append(importutils.import_object(mod))
    
    return objs



